
import 'package:dio/dio.dart';

import '../request/api_client.dart';
import '../request/response_data.dart';

class UserAPI {

  //设备列表
  static Future<ResponseData> selectEquipment(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/SPT/sys/app/selectEquipment",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //设备新增
  static Future<ResponseData> addDevice(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/SPT/sys/app/add",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //设备删除
  static Future<ResponseData> deleteDevice(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.delete("/SPT/sys/app/delete",queryParameters: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //获取用户信息
  static Future<ResponseData> getUserInfo() async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/user/getUser",);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //获取用户信息
  static Future<ResponseData> problemFeedback(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/SPT/sys/app/user/problemFeedback",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //获取问题反馈邮箱,号码
  static Future<ResponseData> getFeedbackInfo() async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/user/getFeedbackInfo");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //文件上传
  static Future<ResponseData> commonUpload(FormData data) async {
    ResponseData responseData = await ApiClient.post("/SPT/sys/app/common/upload",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //修改邮箱获取验证码
  static Future<ResponseData> getCodeByChangeEmail(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/SPT/sys/app/user/updateGmailCode",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //修改邮箱
  static Future<ResponseData> updateGmailCodeLogin(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/SPT/sys/app/user/updateGmailCodeLogin",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //修改密码
  static Future<ResponseData> updatePassWord(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/SPT/sys/app/user/updatePassWord",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //获取用户下级用户列表
  static Future<ResponseData> getUserChild() async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/userParent/getUserChild");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //获取用等级
  static Future<ResponseData> getUserGrade() async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/userParent/getUserGrade");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //同意邀请
  static Future<ResponseData> invitationAgree(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/SPT/sys/app/userParent/invitationAgree",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //邀请用户
  static Future<ResponseData> invitationUser(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/SPT/sys/app/userParent/invitationUser",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //邀请用户
  static Future<ResponseData> invitationDel(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/SPT/sys/app/userParent/invitationDel",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //获取版本号
  static Future<ResponseData> getVersion(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/getVersion",queryParameters: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //获取州地址
  static Future<ResponseData> deviceStateAddress() async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/deviceStateAddress",);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //获取市地址
  static Future<ResponseData> deviceCitiesAddress(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/deviceCitiesAddress",queryParameters: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //installSave
  static Future<ResponseData> installSave(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/SPT/sys/app/Installation/signInstallation",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //installSave
  static Future<ResponseData> getInstallInfo() async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/Installation/installationInfo");
    return ResponseData.createFrom(responseData, responseData.data);
  }

}